package com.xcity.util;

import naga.x.game.time.TimeUpdater;
import naga.x.net.Session;

public class SessionUtils implements naga.x.util.SessionUtils {

	public static final String ACCOUNT = ".account";
	public static final String LAST_TURNTABLE_TIME = ".lastTurntableTime";
	public static final String LAST_PUB_CHAT_TIME = ".lastPubChatTime";
	public static final String LAST_CONQUEST_TAX_TIME = ".lastTaxTime";
//	String COMBAT_LISTENER = ".combatListener";
//	String LAST_OPEN_TREASURE_TIME = ".lastOpenTreasureTime";
	public static final String VISIT_HOST_ID = ".visit"; // 参观目标玩家id
	public static final String FRESHER_WHEN_LOGIN = ".fresh"; // 登录时是否还未过新手引导
	public static final String LAST_FORMATION_FAST_SET_TIME = ".lastFormationFast";
	public static final String ADVENTURE_STEAL_RESPONSE = "__advStealRes";
	public static final String ASK_FRIEND_PRESENT_STRENGTH_PREFIX = ".askPStr";
	public static final String QQ_SHARE_PREFIX = ".qqs";
	
	static final int DEFAULT_OPERATE_GAP = 1000;
	
	public static boolean isOperateTooFrequent(Session session, String op) {
		Long lastTaxTime = session.getAttribute(op);
		if (lastTaxTime != null && lastTaxTime + DEFAULT_OPERATE_GAP >= TimeUpdater.getInstance().now()) {
			return true;
		}
		session.setAttribute(op, TimeUpdater.getInstance().now());
		return false;
	}
	
}
